package com.top.mall.main.mine

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.module.lemlin.owner.OwnerViewModeFragment
import com.top.mall.R
import com.top.mall.jetpack.vm.AccessViewModel
import com.top.mall.main.home.MainActivity
import kotlinx.android.synthetic.main.include_integral_sign.*
import kotlinx.android.synthetic.main.include_integral_task.*

class IntegralEarnedFragment : OwnerViewModeFragment<AccessViewModel>() {

    companion object {
        fun newInstance(): IntegralEarnedFragment {
            return IntegralEarnedFragment()
        }
    }

    private val signAdapter =
        object : BaseQuickAdapter<String, BaseViewHolder>(R.layout.item_integral_sign) {
            override fun convert(holder: BaseViewHolder, item: String) {

            }
        }

    override val layoutResId: Int
        get() = R.layout.fragment_integral_earned

    override fun viewModel(): AccessViewModel {
        return createViewModel()
    }

    override fun initView() {
        rvIntegralSignBody.apply {
//            val decoration = SpacingItemDecoration(
//                nSpan = 7,
//                vGap = ConvertUtils.dp2px(15f),
//                hGap = ConvertUtils.dp2px(15f),
//                isEdge = false
//            )
//            addItemDecoration(decoration)
        }.adapter = signAdapter

        tvIntegralTaskGoGoods.setOnClickListener {
            MainActivity.open()
        }

        tvIntegralTaskGoProfile.setOnClickListener {
            MineProfileActivity.open(requireActivity())
        }
    }

    override fun initData() {
        val exchange: MutableList<String> = mutableListOf()
        for (index: Int in 0 until 7) {
            exchange.add(index.toString())
        }
        signAdapter.setNewInstance(exchange)
    }

}